home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
mus
/
midi
/
XGToolset5_src.lha
/
XGToolset_src
/
XGDrum
/
XGDrum.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-02-13
|
80KB
|
1,883 lines
/*
XG-DRUM-Editor V1.3
A Bars and Pipes tool for editing the DB50-XG-board from YAMAHA.
Use it together with the other XG ... .ptool ' s -
© 1998 Alfred & Matthias Faust
The Tool-code based farly on the code for the "pc3.ptool" from Richard
Hagen. That's a very good tool, many thanks to him.
Richard has written his tool with DICE. We altered the code to compile
with the free GNU-C-compiler of the ADE. Especially the part was
transcripted, that place the imagedate in chip-RAM, because the
GNU-C-compiler hasn't as yet a keyword like DICE or other compiler for
this.
This code is released into the Public Domain, and may be freely
distributed in its original form.
It is supplied ``as is'', and comes with no warranty. This instrument code
was released because it might be useful as a starting point for other
instrumentmers. However, if any damage arises from its use, the original
author and we will not be held liable.
You are free to use and modify this code to your heart's content,
provided you acknowledge me as the original author in any code that you
might distribute which is based largely on this code.
I acknowledge that the design of this tool is influenced strongly by
the example code supplied with the Rules for Tools package. However, I
have made substantial contributions of my own.
Matthias & Alfred Faust
j.k.dax@t-online.de
History:
1.0 (4.12.1998)
Initial Release.
1.1 - 1.2
overjumping, because all tools shall have the same version number
1.3 (13.02.1999)
all slidervalues will be stored with the tool in the track
*/
#include "bars.h"
#include "myheader.h" // from R.Hagen
#include <libraries/dos.h>
#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <exec/memory.h>
#include <exec/execbase.h>
#include <exec/types.h>
#include <string.h>
#include <intuition/intuition.h>
#include "soundmatrix.c" //all the soundnames
char version[]="\0$VER:DrumXG-Edit 1.3 (13.12.1999) © Alfred & Matthias Faust";
#define DRXG_NAME "XG-Drum-Edit"
#define DRXG_ID 0x44525847
#define DRXG_TYPE (TOOL_NORMAL | TOOL_NOTPAD)
//all the default values of the slider-storage
UBYTE initstorage[1580]={
0x00,0x00,0x40,0x40,0x66,0x03,0x33,0x5F,0x5F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x79,0x03,0x33,0x5F,0x5F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x3F,0x00,0x33,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x33,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x5D,0x04,0x34,0x3F,0x3F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x74,0x04,0x34,0x3F,0x3F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x4B,0x00,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00, //G-1
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x5E,0x00,0x40,0x3F,0x3F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x62,0x00,0x40,0x3F,0x3F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x5C,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x77,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00, //C0
0x00,0x00,0x40,0x40,0x31,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x2F,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x34,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x2D,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x4F,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x3F,0x3F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x4B,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00, //G0
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x74,0x00,0x40,0x20,0x20,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x66,0x00,0x40,0x20,0x20,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x20,0x20,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00, //C1
0x00,0x00,0x40,0x40,0x5D,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x6E,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7B,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x6F,0x00,0x18,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x5B,0x01,0x4D,0x20,0x20,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x71,0x00,0x27,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00, //G1
0x00,0x00,0x40,0x40,0x5C,0x01,0x4D,0x20,0x20,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x63,0x00,0x34,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x60,0x01,0x4D,0x20,0x20,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x57,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x63,0x00,0x53,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00, //C2
0x00,0x00,0x40,0x40,0x7F,0x00,0x45,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x74,0x00,0x68,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x69,0x00,0x22,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x78,0x00,0x22,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x6B,0x00,0x2E,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x74,0x00,0x40,0x3F,0x3F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00, //G2
0x00,0x00,0x40,0x40,0x76,0x00,0x4D,0x3F,0x3F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x33,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x6A,0x00,0x19,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x6E,0x00,0x2E,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x6E,0x00,0x72,0x5F,0x5F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00, //C3
0x00,0x00,0x40,0x40,0x57,0x00,0x72,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x49,0x00,0x27,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x59,0x00,0x19,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x6F,0x00,0x40,0x5F,0x5F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x5B,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x5F,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x6C,0x00,0x22,0x64,0x64,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00, //G3
0x00,0x00,0x40,0x40,0x6C,0x00,0x22,0x64,0x64,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x5A,0x00,0x1C,0x3F,0x3F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x63,0x00,0x15,0x3F,0x3F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x67,0x00,0x65,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x6E,0x00,0x65,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00, //C4
0x00,0x00,0x40,0x40,0x7C,0x00,0x5F,0x3F,0x3F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x6A,0x00,0x72,0x3F,0x3F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x58,0x00,0x40,0x5F,0x5F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x6B,0x00,0x68,0x5F,0x5F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x60,0x00,0x68,0x5F,0x5F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x61,0x00,0x15,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x6B,0x00,0x22,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00, //G4
0x00,0x00,0x40,0x40,0x7F,0x02,0x19,0x5F,0x5F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x02,0x19,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x6A,0x00,0x53,0x3F,0x3F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7B,0x00,0x69,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x44,0x00,0x40,0x7F,0x7F,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x28,0x28,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x28,0x28,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x28,0x28,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x28,0x28,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x28,0x28,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x28,0x28,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00,
0x00,0x00,0x40,0x40,0x7F,0x00,0x40,0x28,0x28,0x7F,0x00,0x01,0x01,0x40,0x40,0x40,0x40,0x40,0x01,0x00};
// the litte Icon in the pipeline
UWORD *DRXG=NULL;
static UWORD DRXGdata[] =
{
/* Plane 0 */
0x7FFF,0xFE00,
0x7FFF,0xFE00,
0x7F81,0xFE00,
0x7EC3,0xDE00,
0x7D01,0xF600,
0x7D00,0xDE00,
0x7D00,0xDE00,
0x7D00,0xDE00,
0x7A81,0xDE00,
0x7743,0xAE00,
0x7FFF,0xFE00,
0x7FFF,0xFE00,
/* Plane 1 */
0x0000,0x00200,
0x0000,0x00600,
0x1F83,0xFE00,
0x11C7,0xBE00,
0x8ABA,0x00F00,
0x9B7D,0xBF00,
0x9B7D,0xBF00,
0x9B7D,0xBF00,
0x15BB,0xBE00,
0x0EC7,0x5E00,
0x1FFF,0xFE00,
0x3FFF,0xFE00,
/* Plane 2 */
0x0000,0x00000,
0x0000,0x00000,
0x1FFD,0xF800,
0x1EFB,0xD800,
0x1D7D,0xF000,
0x1DFE,0xD800,
0x1DFE,0xD800,
0x1DFE,0xD800,
0x1AFD,0xD800,
0x177B,0xA800,
0x0000,0x00000,
0x0000,0x00000
};
static struct Image DRXG_image = {
0, 0,
24 , 12 , 3 ,
NULL,
0x1f, 0x00,
NULL
};
//Definitions of the gadgets
#define KIT_GADGET 1
#define INSTRUMENT_GADGET 2
#define PITCHCOURSE_GADGET 3
#define PITCHFINE_GADGET 4
#define LEVEL_GADGET 5
#define ALTERNATE_GADGET 6
#define PAN_GADGET 7
#define REVERB_GADGET 8
#define CHORUS_GADGET 9
#define VARFX_GADGET 10
#define KEYASSIGN_GADGET 11
#define RCVNOTEOFF_GADGET 12
#define RCVNOTEON_GADGET 13
#define FICUTOFFREQ_GADGET 14
#define FICUTOFFRESON_GADGET 15
#define ATTACK_GADGET 16
#define DECAYA_GADGET 17
#define DECAYB_GADGET 18
#define VXON_GADGET 19
#define DRUMSET_GADGET 20
#define WRITE_GADGET 21
#define DEFAULT_GADGET 22
//all the gadgets
// KIT gadget.
struct PropInfo DRXGGadget1Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/11, -1, };
struct Image DRXGImage1 = {
0, 0, 10, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText1 = {
2, 0, JAM1, -65, 1, NULL, " Kit", NULL };
struct Gadget DRXGGadget1 = {
NULL, 70, 52, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage1, NULL, &DRXGText1, NULL, (APTR)&DRXGGadget1Info, KIT_GADGET, NULL };
// INSTRUMENT gadget.
struct PropInfo DRXGGadget2Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/79, -1, };
struct Image DRXGImage2 = {
0, 0, 102, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText2 = {
2, 0, JAM1, -65, 1, NULL, "Instrm#", NULL };
struct Gadget DRXGGadget2 = {
&DRXGGadget1, 70, 42, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage2, NULL, &DRXGText2, NULL, (APTR)&DRXGGadget2Info, INSTRUMENT_GADGET, NULL };
// PITCHCOURSE gadget.
struct PropInfo DRXGGadget3SInfo = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY *1/128, -1, };
struct Image DRXGImage3 = {
0, 0, 10, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText3 = {
2, 0, JAM1, -65, 1, NULL, "PitchCs", NULL };
struct Gadget DRXGGadget3 = {
&DRXGGadget2, 70, 72, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage3, NULL, &DRXGText3, NULL, (APTR)&DRXGGadget3SInfo, PITCHCOURSE_GADGET, NULL };
// PITCHFINE gadget.
struct PropInfo DRXGGadget4SInfo = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY *1/128, -1, };
struct Image DRXGImage4 = {
0, 0, 10, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText4 = {
2, 0, JAM1, -65, 1, NULL, "PitchFn", NULL };
struct Gadget DRXGGadget4 = {
&DRXGGadget3, 70, 82, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage4, NULL, &DRXGText4, NULL, (APTR)&DRXGGadget4SInfo, PITCHFINE_GADGET, NULL };
// LEVEL gadget.
struct PropInfo DRXGGadget5SInfo = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY *1/128, -1, };
struct Image DRXGImage5 = {
0, 0, 10, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText5 = {
2, 0, JAM1, -65, 1, NULL, " Volume", NULL };
struct Gadget DRXGGadget5 = {
&DRXGGadget4, 70, 92, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage5, NULL, &DRXGText5, NULL, (APTR)&DRXGGadget5SInfo, LEVEL_GADGET, NULL };
// ALTERNATE gadget.
struct PropInfo DRXGGadget6SInfo = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/128, -1, };
struct Image DRXGImage6 = {
0, 0, 10, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText6 = {
2, 0, JAM1, -65, 1, NULL, "Altnate", NULL };
struct Gadget DRXGGadget6 = {
&DRXGGadget5, 70, 102, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage6, NULL, &DRXGText6, NULL, (APTR)&DRXGGadget6SInfo, ALTERNATE_GADGET, NULL };
// PANPOT gadget.
struct PropInfo DRXGGadget7SInfo = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/128 , -1, };
struct Image DRXGImage7 = {
0, 0, 10, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText7 = {
2, 0, JAM1, -65, 1, NULL, " Panpot", NULL };
struct Gadget DRXGGadget7 = {
&DRXGGadget6, 70, 112, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage7, NULL, &DRXGText7, NULL, (APTR)&DRXGGadget7SInfo, PAN_GADGET, NULL };
// REVERB gadget.
struct PropInfo DRXGGadget8SInfo = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/128 , -1, };
struct Image DRXGImage8 = {
0, 0, 10, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText8 = {
2, 0, JAM1, -65, 1, NULL, " Reverb", NULL };
struct Gadget DRXGGadget8 = {
&DRXGGadget7, 70, 122, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage8, NULL, &DRXGText8, NULL, (APTR)&DRXGGadget8SInfo, REVERB_GADGET, NULL };
// CHORUS Gadget
struct PropInfo DRXGGadget9Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/128, -1, };
struct Image DRXGImage9 = {
0, 0, 102, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText9 = {
2, 0, JAM1, -65, 1, NULL, " Chorus", NULL };
struct Gadget DRXGGadget9 = {
&DRXGGadget8, 70, 132, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage9, NULL, &DRXGText9, NULL, (APTR)&DRXGGadget9Info, CHORUS_GADGET, NULL };
// VARFX gadget
struct PropInfo DRXGGadget10Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/128, -1, };
struct Image DRXGImage10 = {
0, 0, 102, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText10 = {
2, 0, JAM1, -65, 1, NULL, " VarFX", NULL };
struct Gadget DRXGGadget10 = {
&DRXGGadget9, 70, 142, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage10, NULL, &DRXGText10, NULL, (APTR)&DRXGGadget10Info, VARFX_GADGET, NULL };
// KEYASSIGN Gadget
struct PropInfo DRXGGadget11Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/2, -1, };
struct Image DRXGImage11 = {
0, 0, 102, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText11 = {
2, 0, JAM1, -45, 1, NULL, "KAsgn", NULL };
struct Gadget DRXGGadget11 = {
&DRXGGadget10, 320, 72, 20, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage11, NULL, &DRXGText11, NULL, (APTR)&DRXGGadget11Info, KEYASSIGN_GADGET, NULL };
// RCVNOTEOFF Gadget
struct PropInfo DRXGGadget12Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/2, -1, };
struct Image DRXGImage12 = {
0, 0, 102, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText12 = {
2, 0, JAM1, -45, 1, NULL, "RNoff", NULL };
struct Gadget DRXGGadget12 = {
&DRXGGadget11, 320, 82, 20, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage12, NULL, &DRXGText12, NULL, (APTR)&DRXGGadget12Info, RCVNOTEOFF_GADGET, NULL };
// RCVNOTEON Gadget
struct PropInfo DRXGGadget13Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/2, -1, };
struct Image DRXGImage13 = {
0, 0, 102, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText13 = {
2, 0, JAM1, -45, 1, NULL, "RvNon", NULL };
struct Gadget DRXGGadget13 = {
&DRXGGadget12, 320, 92, 20, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage13, NULL, &DRXGText13, NULL, (APTR)&DRXGGadget13Info, RCVNOTEON_GADGET, NULL };
// FICUTOFFREQ Gadget
struct PropInfo DRXGGadget14Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/128, -1, };
struct Image DRXGImage14 = {
0, 0, 102, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText14 = {
2, 0, JAM1, -65, 1, NULL, "FCutoff", NULL };
struct Gadget DRXGGadget14 = {
&DRXGGadget13, 70, 162, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage14, NULL, &DRXGText14, NULL, (APTR)&DRXGGadget14Info, FICUTOFFREQ_GADGET, NULL };
// FIRESON Gadget
struct PropInfo DRXGGadget15Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/128, -1, };
struct Image DRXGImage15 = {
0, 0, 102, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText15 = {
2, 0, JAM1, -65, 1, NULL, "FiReson", NULL };
struct Gadget DRXGGadget15 = {
&DRXGGadget14, 70, 172, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage15, NULL, &DRXGText15, NULL, (APTR)&DRXGGadget15Info, FICUTOFFRESON_GADGET, NULL };
// ATTACK Gadget
struct PropInfo DRXGGadget16Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/128, -1, };
struct Image DRXGImage16 = {
0, 0, 102, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText16 = {
2, 0, JAM1, -65, 1, NULL, " Attack", NULL };
struct Gadget DRXGGadget16 = {
&DRXGGadget15, 70, 182, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage16, NULL, &DRXGText16, NULL, (APTR)&DRXGGadget16Info, ATTACK_GADGET, NULL };
// DECAYA Gadget
struct PropInfo DRXGGadget17Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/128, -1, };
struct Image DRXGImage17 = {
0, 0, 102, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText17 = {
2, 0, JAM1, -65, 1, NULL, "Decay 1", NULL };
struct Gadget DRXGGadget17 = {
&DRXGGadget16, 70, 192, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage17, NULL, &DRXGText17, NULL, (APTR)&DRXGGadget17Info, DECAYA_GADGET, NULL };
// DECAYB Gadget
struct PropInfo DRXGGadget18Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/128, -1, };
struct Image DRXGImage18 = {
0, 0, 102, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText18 = {
2, 0, JAM1, -65, 1, NULL, "Decay 2", NULL };
struct Gadget DRXGGadget18 = {
&DRXGGadget17, 70, 202, 157, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage18, NULL, &DRXGText18, NULL, (APTR)&DRXGGadget18Info, DECAYB_GADGET, NULL };
// VXON Gadget
struct PropInfo DRXGGadget19Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/2, -1, };
struct Image DRXGImage19 = {
0, 0, 102, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText19 = {
2, 0, JAM1, 19, 1, NULL, "VFX:", NULL };
struct Gadget DRXGGadget19 = {
&DRXGGadget18, 275, 142, 15, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage19, NULL, &DRXGText19, NULL, (APTR)&DRXGGadget19Info, VXON_GADGET, NULL };
// DRUMSET Gadget
struct PropInfo DRXGGadget20Info = {
AUTOKNOB+FREEHORIZ, 0, -1, MAXBODY * 1/2, -1, };
struct Image DRXGImage20 = {
0, 0, 102, 6, 0, NULL, 0x0000, 0x0000, NULL };
struct IntuiText DRXGText20 = {
2, 0, JAM1, -35, 1, NULL, "DSet", NULL };
struct Gadget DRXGGadget20 = {
&DRXGGadget19, 40, 24, 13, 8, GFLG_GADGHBOX|GFLG_GADGHIMAGE, RELVERIFY|GADGIMMEDIATE, PROPGADGET,
(APTR)&DRXGImage20, NULL, &DRXGText20, NULL, (APTR)&DRXGGadget20Info, DRUMSET_GADGET, NULL };
// Write gadget.
struct IntuiText DRXGIText21 = {
4,0,JAM1,12,2,NULL,"Write",NULL
};
struct Gadget DRXGGadget21 = {
&DRXGGadget20,300, 187, 65,11,GFLG_GADGHBOX|GFLG_GADGHIMAGE,RELVERIFY|GADGIMMEDIATE,BOOLGADGET,
(APTR)NULL,NULL,&DRXGIText21,NULL,NULL,WRITE_GADGET,NULL
};
// Default gadget.
struct IntuiText DRXGIText22 = {
4,0,JAM1,4,2,NULL,"Default",NULL
};
struct Gadget DRXGGadget22 = {
&DRXGGadget21,300, 174, 65,11,GFLG_GADGHBOX|GFLG_GADGHIMAGE,RELVERIFY|GADGIMMEDIATE,BOOLGADGET,
(APTR)NULL,NULL,&DRXGIText22,NULL,NULL,DEFAULT_GADGET,NULL
};
//the mainwindowstructure
struct NewWindow DRXGNewWindowStructure1 = {
0, 10,
407, 220,
0, 6,
GADGETDOWN|GADGETUP|CLOSEWINDOW,
WINDOWDRAG|WINDOWDEPTH|WINDOWCLOSE|ACTIVATE|NOCAREREFRESH,
&DRXGGadget22,
NULL,
"XG Drum Editor",
NULL,
NULL,
5, 5,
-1, -1,
CUSTOMSCREEN
};
extern struct ExecBase * SysBase;
UBYTE instrm, kitnr;
struct DRXGTool {
struct Tool tool;
UBYTE kit;
UBYTE instrument;
UBYTE pitchcourse;
UBYTE pitchfine;
UBYTE level;
UBYTE alternate;
UBYTE pan;
UBYTE reverb;
UBYTE chorus;
UBYTE varfx;
UBYTE keyassign;
UBYTE rcvnoteoff;
UBYTE rcvnoteon;
UBYTE ficutoffreq;
UBYTE ficutoffreson;
UBYTE attack;
UBYTE decaya;
UBYTE decayb;
UBYTE vxon;
UBYTE drumset;
UBYTE writesw[1580];
UBYTE valstorage[1580];
UBYTE msba;
UBYTE msbb;
char *kitsysex;
char *instrumentsysex;
char *pitchcoursesysex;
char *pitchfinesysex;
char *levelsysex;
char *alternatesysex;
char *pansysex;
char *reverbsysex;
char *chorussysex;
char *varfxsysex;
char *keyassignsysex;
char *rcvnoteoffsysex;
char *rcvnoteonsysex;
char *ficutoffreqsysex;
char *ficutoffresonsysex;
char *attacksysex;
char *decayasysex;
char *decaybsysex;
char *vxonsysex;
char *drumsetsysex;
char *msbasysex;
char *msbbsysex;
};
static struct ToolMaster master;
extern struct Functions *functions;
//initial values
static void DRXG_tool_init(struct DRXGTool *tool)
{
int b;
tool->valstorage[0] = initstorage[0];
tool->valstorage[1] = initstorage[1];
tool->valstorage[19] = initstorage[19];
for (b=0; b<=78 ;b++)
{
tool->valstorage[(b*20)+2] = initstorage[(b*20)+2];
tool->valstorage[(b*20)+3] = initstorage[(b*20)+3];
tool->valstorage[(b*20)+4] = initstorage[(b*20)+4];
tool->valstorage[(b*20)+5] = initstorage[(b*20)+5];
tool->valstorage[(b*20)+6] = initstorage[(b*20)+6];
tool->valstorage[(b*20)+7] = initstorage[(b*20)+7];
tool->valstorage[(b*20)+8] = initstorage[(b*20)+8];
tool->valstorage[(b*20)+9] = initstorage[(b*20)+9];
tool->valstorage[(b*20)+10] = initstorage[(b*20)+10];
tool->valstorage[(b*20)+11] = initstorage[(b*20)+11];
tool->valstorage[(b*20)+12] = initstorage[(b*20)+12];
tool->valstorage[(b*20)+13] = initstorage[(b*20)+13];
tool->valstorage[(b*20)+14] = initstorage[(b*20)+14];
tool->valstorage[(b*20)+15] = initstorage[(b*20)+15];
tool->valstorage[(b*20)+16] = initstorage[(b*20)+16];
tool->valstorage[(b*20)+17] = initstorage[(b*20)+17];
tool->valstorage[(b*20)+18] = initstorage[(b*20)+18];
}
tool->tool.touched = TOUCH_INIT;
tool->kit = tool->valstorage[0];
tool->instrument = tool->valstorage[1];
tool->pitchcourse = tool->valstorage[2];
tool->pitchfine = tool->valstorage[3];
tool->level = tool->valstorage[4];
tool->alternate = tool->valstorage[5];
tool->pan = tool->valstorage[6];
tool->reverb = tool->valstorage[7];
tool->chorus = tool->valstorage[8];
tool->varfx = tool->valstorage[9];
tool->keyassign = tool->valstorage[10];
tool->rcvnoteoff = tool->valstorage[11];
tool->rcvnoteon = tool->valstorage[12];
tool->ficutoffreq = tool->valstorage[13];
tool->ficutoffreson = tool->valstorage[14];
tool->attack = tool->valstorage[15];
tool->decaya = tool->valstorage[16];
tool->decayb = tool->valstorage[17];
tool->vxon = tool->valstorage[18];
tool->drumset = tool->valstorage[19];
tool->msba = 0;
tool->msbb = 0;
tool->kitsysex = NULL;
tool->instrumentsysex = NULL;
tool->pitchcoursesysex = NULL;
tool->pitchfinesysex = NULL;
tool->levelsysex = NULL;
tool->alternatesysex = NULL;
tool->pansysex = NULL;
tool->reverbsysex = NULL;
tool->chorussysex = NULL;
tool->varfxsysex = NULL;
tool->keyassignsysex = NULL;
tool->rcvnoteoffsysex = NULL;
tool->rcvnoteonsysex = NULL;
tool->ficutoffreqsysex = NULL;
tool->ficutoffresonsysex = NULL;
tool->attacksysex = NULL;
tool->decayasysex = NULL;
tool->decaybsysex = NULL;
tool->vxonsysex = NULL;
tool->drumsetsysex = NULL;
tool->msbasysex = NULL;
tool->msbbsysex = NULL;
for (b=0; b<=1580; b++)
{tool->writesw[b]=0;}
}
static struct Event * __saveds processeventcode(struct Event *event)
{
event->tool = event->tool->next;
return(event);
}
static BOOL lock_clip(struct Clip *clip)
{
Forbid();
if (clip->locked == 0)
{
clip->locked = 1;
Permit();
return TRUE;
}
else
{
Permit();
return FALSE;
}
}
static void unlock_clip(struct Clip *clip)
{
clip->locked = 0;
}
//writes sysex into track
static void __saveds insertsysex(char *buff, short size, struct DRXGTool *tool, const LONG time)
{
struct StringEvent *event;
struct String *string;
event = (struct StringEvent *) (*functions->allocevent)();
if (event)
{
string = (struct String *) (*functions->myalloc)(size + 3, MEMF_CLEAR);
if (string)
{
event->next = NULL;
event->string = string;
memcpy(string->string, buff, size);
string->length = size + 2;
event->type = EVENT_SYSX;
event->status = MIDI_SYSX;
event->time = time;
event->tool = tool->tool.next;
if (lock_clip(&(tool->tool.track->clip)))
{
event->next = (struct StringEvent *)tool->tool.track->clip.events.first;
tool->tool.track->clip.events.first = (struct Event *)(*functions->sorteventlist)(event);
unlock_clip(&(tool->tool.track->clip));
}
else
{
(*functions->freelist)(event);
}
}
}
}
// initialize the VarfxON
static void __saveds initvx(struct DRXGTool *tool, const LONG time)
{
struct Event *vxevent = (struct Event *)(*functions->allocevent)();
if (vxevent)
{
vxevent->type = EVENT_VOICE;
vxevent->status = MIDI_CCHANGE;
vxevent->byte1 = 94;
vxevent->byte2 = 100;
vxevent->time = time;
vxevent->next = NULL;
vxevent->tool = tool->tool.next;
(*functions->qevent)(vxevent);
}
}
// the routine for sending SysEx-data thru the pipeline
static void __saveds sendsysex(char *buff, short size, struct DRXGTool *tool, const LONG time)
{
struct StringEvent *event;
struct String *string;
event = (struct StringEvent *) (*functions->allocevent)();
if (event)
{
string = (struct String *) (*functions->myalloc)(size + 3, MEMF_CLEAR);
if (string)
{
event->string = string;
memcpy(string->string, buff, size);
string->length = size + 2;
event->type = EVENT_SYSX;
event->status = MIDI_SYSX;
event->time = time;
event->tool = tool->tool.next;
WaitTOF();
(*functions->qevent)(event);
(*functions->myfree)(string);
}
}
}
static void __saveds trans_hx(struct DRXGTool *tool, const LONG time, char *sysx, int sw)
{
LONG size;
int a, b, x, y ;
UBYTE abuf[32];
char chr[4];
char *zbuf = NULL;
struct Event *sysx_event;
//translate sysexbuffer into hex
size = strlen(sysx);
zbuf = (char *)AllocVec(size+2, MEMF_ANY|MEMF_CLEAR);
if(zbuf)
{
CopyMem(sysx, zbuf, size);
b=0;
for(a=0;a < size;a=a+2)
{
chr[0] = zbuf[a];
chr[1] = zbuf[a+1];
x=(isdigit((int)chr[0]))? (chr[0]&0xF) : ((chr[0]&0xDF)-55); //this is the
y=(isdigit((int)chr[1]))? (chr[1]&0xF) : ((chr[1]&0xDF)-55); //the translate-core
abuf[b++] = ((x<<4)|y); //writing with bitmanipulation
}
//send hexdata
FreeVec(zbuf);
if (sw == 0) sendsysex(abuf, b, tool, time);
if (sw == 1) insertsysex(abuf, b, tool, time);
}
}
//to put all the sliders to the value, that's stored
void initslider(struct DRXGTool *tool, struct Window *window)
{
int i, b, a = (tool->valstorage[1]-13)*20;
tool->pitchcourse = tool->valstorage[2+a] ;
tool->pitchfine = tool->valstorage[3+a] ;
tool->level = tool->valstorage[4+a] ;
tool->alternate = tool->valstorage[5+a] ;
tool->pan = tool->valstorage[6+a] ;
tool->reverb = tool->valstorage[7+a] ;
tool->chorus = tool->valstorage[8+a] ;
tool->varfx = tool->valstorage[9+a] ;
tool->keyassign = tool->valstorage[10+a];
tool->rcvnoteoff = tool->valstorage[11+a];
tool->rcvnoteon = tool->valstorage[12+a];
tool->ficutoffreq = tool->valstorage[13+a];
tool->ficutoffreson = tool->valstorage[14+a];
tool->attack = tool->valstorage[15+a];
tool->decaya = tool->valstorage[16+a];
tool->decayb = tool->valstorage[17+a];
tool->vxon = tool->valstorage[18];
(*functions->ModifyEmbossedProp)(window, PITCHCOURSE_GADGET , tool->pitchcourse, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, PITCHFINE_GADGET , tool->pitchfine, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, LEVEL_GADGET , tool->level, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, ALTERNATE_GADGET , tool->alternate, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, PAN_GADGET , tool->pan, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, REVERB_GADGET , tool->reverb, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, CHORUS_GADGET , tool->chorus, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, VARFX_GADGET , tool->varfx, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, KEYASSIGN_GADGET , tool->keyassign, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, RCVNOTEOFF_GADGET , tool->rcvnoteoff, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, RCVNOTEON_GADGET , tool->rcvnoteon, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, FICUTOFFREQ_GADGET , tool->ficutoffreq, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, FICUTOFFRESON_GADGET , tool->ficutoffreson, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, ATTACK_GADGET , tool->attack, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, DECAYA_GADGET , tool->decaya, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, DECAYB_GADGET , tool->decayb, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, VXON_GADGET , tool->vxon, 0, 0, 0, 0, 0);
for (i= PITCHCOURSE_GADGET; i<=VXON_GADGET ; i++)
{
(*functions->DrawEmbossedProp)(window, i);
}
}
//to put all the sliders to the default values
void defaultslider(struct DRXGTool *tool, struct Window *window)
{
int i, b;
LONG time, a = ((tool->valstorage[1])-13)*20;
char storage1[32];
char storage2[32];
char storage3[32];
char storage4[32];
char storage5[32];
char storage6[32];
char storage7[32];
char storage8[32];
char storage9[32];
char storage10[32];
char storage11[32];
char storage12[32];
char storage13[32];
char storage14[32];
char storage15[32];
char storage16[32];
char storage17[32];
tool->valstorage[2+a] = initstorage[a+2];
tool->valstorage[3+a] = initstorage[a+3];
tool->valstorage[4+a] = initstorage[a+4];
tool->valstorage[5+a] = initstorage[a+5];
tool->valstorage[6+a] = initstorage[a+6];
tool->valstorage[7+a] = initstorage[a+7];
tool->valstorage[8+a] = initstorage[a+8];
tool->valstorage[9+a] = initstorage[a+9];
tool->valstorage[10+a] = initstorage[a+10];
tool->valstorage[11+a] = initstorage[a+11];
tool->valstorage[12+a] = initstorage[a+12];
tool->valstorage[13+a] = initstorage[a+13];
tool->valstorage[14+a] = initstorage[a+14];
tool->valstorage[15+a] = initstorage[a+15];
tool->valstorage[16+a] = initstorage[a+16];
tool->valstorage[17+a] = initstorage[a+17];
tool->valstorage[18+a] = initstorage[a+18];
tool->pitchcourse = tool->valstorage[2+a] ;
tool->pitchfine = tool->valstorage[3+a] ;
tool->level = tool->valstorage[4+a] ;
tool->alternate = tool->valstorage[5+a] ;
tool->pan = tool->valstorage[6+a] ;
tool->reverb = tool->valstorage[7+a] ;
tool->chorus = tool->valstorage[8+a] ;
tool->varfx = tool->valstorage[9+a] ;
tool->keyassign = tool->valstorage[10+a];
tool->rcvnoteoff = tool->valstorage[11+a];
tool->rcvnoteon = tool->valstorage[12+a];
tool->ficutoffreq = tool->valstorage[13+a];
tool->ficutoffreson = tool->valstorage[14+a];
tool->attack = tool->valstorage[15+a];
tool->decaya = tool->valstorage[16+a];
tool->decayb = tool->valstorage[17+a];
tool->vxon = tool->valstorage[18];
for (b=2; b<=18; b++)
{tool->writesw[b+a]=0;}
(*functions->ModifyEmbossedProp)(window, PITCHCOURSE_GADGET , tool->pitchcourse, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, PITCHFINE_GADGET , tool->pitchfine, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, LEVEL_GADGET , tool->level, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, ALTERNATE_GADGET , tool->alternate, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, PAN_GADGET , tool->pan, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, REVERB_GADGET , tool->reverb, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, CHORUS_GADGET , tool->chorus, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, VARFX_GADGET , tool->varfx, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, KEYASSIGN_GADGET , tool->keyassign, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, RCVNOTEOFF_GADGET , tool->rcvnoteoff, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, RCVNOTEON_GADGET , tool->rcvnoteon, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, FICUTOFFREQ_GADGET , tool->ficutoffreq, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, FICUTOFFRESON_GADGET , tool->ficutoffreson, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, ATTACK_GADGET , tool->attack, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, DECAYA_GADGET , tool->decaya, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, DECAYB_GADGET , tool->decayb, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, VXON_GADGET , tool->vxon, 0, 0, 0, 0, 0);
for (i= PITCHCOURSE_GADGET; i<=VXON_GADGET ; i++)
{
(*functions->DrawEmbossedProp)(window, i);
}
sprintf(storage1, "F043104C3%1lx%02lx00%02lxF7",tool->drumset,tool->valstorage[1],tool->pitchcourse);
tool->pitchcoursesysex = storage1;
time = functions->timenow;
trans_hx(tool, time, tool->pitchcoursesysex, 0);
sprintf(storage2, "F043104C3%1lx%02lx01%02lxF7",tool->drumset,tool->valstorage[1],tool->pitchfine);
tool->pitchfinesysex = storage2;
time = functions->timenow;
trans_hx(tool, time, tool->pitchfinesysex, 0);
sprintf(storage3, "F043104C3%1lx%02lx02%02lxF7",tool->drumset,tool->valstorage[1],tool->level);
tool->levelsysex = storage3;
time = functions->timenow;
trans_hx(tool, time, tool->levelsysex, 0);
sprintf(storage4, "F043104C3%1lx%02lx03%02lxF7",tool->drumset,tool->valstorage[1],tool->alternate);
tool->alternatesysex = storage4;
time = functions->timenow;
trans_hx(tool, time, tool->alternatesysex, 0);
sprintf(storage5, "F043104C3%1lx%02lx04%02lxF7",tool->drumset,tool->valstorage[1],tool->pan);
tool->pansysex = storage5;
time = functions->timenow;
trans_hx(tool, time, tool->pansysex, 0);
sprintf(storage6, "F043104C3%1lx%02lx05%02lxF7",tool->drumset,tool->valstorage[1],tool->reverb);
tool->reverbsysex = storage6;
time = functions->timenow;
trans_hx(tool, time, tool->reverbsysex, 0);
sprintf(storage7, "F043104C3%1lx%02lx06%02lxF7",tool->drumset,tool->valstorage[1],tool->chorus);
tool->chorussysex = storage7;
time = functions->timenow;
trans_hx(tool, time, tool->chorussysex, 0);
sprintf(storage8, "F043104C3%1lx%02lx07%02lxF7",tool->drumset,tool->valstorage[1],tool->varfx);
tool->varfxsysex = storage8;
time = functions->timenow;
trans_hx(tool, time, tool->varfxsysex, 0);
sprintf(storage9, "F043104C3%1lx%02lx08%02lxF7",tool->drumset,tool->valstorage[1],tool->keyassign);
tool->keyassignsysex = storage9;
time = functions->timenow;
trans_hx(tool, time, tool->keyassignsysex, 0);
sprintf(storage10, "F043104C3%1lx%02lx09%02lxF7",tool->drumset,tool->valstorage[1],tool->rcvnoteoff);
tool->rcvnoteoffsysex = storage10;
time = functions->timenow;
trans_hx(tool, time, tool->rcvnoteoffsysex, 0);
sprintf(storage11, "F043104C3%1lx%02lx0A%02lxF7",tool->drumset,tool->valstorage[1],tool->rcvnoteon);
tool->rcvnoteonsysex = storage11;
time = functions->timenow;
trans_hx(tool, time, tool->rcvnoteonsysex, 0);
sprintf(storage12, "F043104C3%1lx%02lx0B%02lxF7",tool->drumset,tool->valstorage[1],tool->ficutoffreq);
tool->ficutoffreqsysex = storage12;
time = functions->timenow;
trans_hx(tool, time, tool->ficutoffreqsysex, 0);
sprintf(storage13, "F043104C3%1lx%02lx0C%02lxF7",tool->drumset,tool->valstorage[1],tool->ficutoffreson);
tool->ficutoffresonsysex = storage13;
time = functions->timenow;
trans_hx(tool, time, tool->ficutoffresonsysex, 0);
sprintf(storage14, "F043104C3%1lx%02lx0D%02lxF7",tool->drumset,tool->valstorage[1],tool->attack);
tool->attacksysex = storage14;
time = functions->timenow;
trans_hx(tool, time, tool->attacksysex, 0);
sprintf(storage15, "F043104C3%1lx%02lx0E%02lxF7",tool->drumset,tool->valstorage[1],tool->decaya);
tool->decayasysex = storage15;
time = functions->timenow;
trans_hx(tool, time, tool->decayasysex, 0);
sprintf(storage16, "F043104C3%1lx%02lx0F%02lxF7",tool->drumset,tool->valstorage[1],tool->decayb);
tool->decaybsysex = storage16;
time = functions->timenow;
trans_hx(tool, time, tool->decaybsysex, 0);
sprintf(storage17, "F043104C02015A%02lxF7",tool->vxon);
tool->vxonsysex = storage17;
time = functions->timenow;
trans_hx(tool, time, tool->vxonsysex, 0);
}
// Writes all values of the sliders and more in the main window
LONG __saveds display_routine(struct Window *window, struct Gadget *gadget, ULONG value)
{
char text[32];
char tname[32];
const short id = gadget->GadgetID;
struct RastPort *rp = window->RPort;
int i=0;
char kit[11][11]=
{
"Standard 1 ", "Standard 2 ", "Rock Kit ", "Room Kit ", "Electro Kit", "Analog Kit ",
"Jazz Kit ", "Brush Kit ", "Classic Kit", "SFX 1 ", "SFX 2 "};
char note[79][4]={
"C#-1"," D-1","D#-1"," E-1"," F-1","F#-1"," G-1","G#-1"," A-1","A#-1"," B-1",
" C0"," C#0"," D0"," D#0"," E0"," F0"," F#0"," G0"," G#0"," A0"," A#0"," B0",
" C1"," C#1"," D1"," D#1"," E1"," F1"," F#1"," G1"," G#1"," A1"," A#1"," B1",
" C2"," C#2"," D2"," D#2"," E2"," F2"," F#2"," G2"," G#2"," A2"," A#2"," B2",
" C3"," C#3"," D3"," D#3"," E3"," F3"," F#3"," G3"," G#3"," A3"," A#3"," B3",
" C4"," C#4"," D4"," D#4"," E4"," F4"," F#4"," G4"," G#4"," A4"," A#4"," B4",
" C5"," C#5"," D5"," D#5"," E5"," F5"," F#5"," G5"};
char keas[2][6]={"Single","Multi "};
char on[3][3]={"off","on ","rdm"};
SetAPen(rp, 6);
SetBPen(rp, 0);
SetDrMd(rp, JAM2);
switch (id)
{
case KIT_GADGET:
kitnr = value;
sprintf(text, "%.11s", kit[value]);
Move(rp, 238, 58);
Text(rp, text, 11);
break;
case INSTRUMENT_GADGET:
instrm = (value+13);
sprintf(text, "%.4s", note[value]);
Move(rp, 238, 48);
Text(rp, text, 4);
break;
case PITCHCOURSE_GADGET:
Move(rp, 238, 78);
sprintf(text, "%3ld", value);
Text(rp, text, 3);
break;
case PITCHFINE_GADGET:
Move(rp, 238, 88);
sprintf(text, "%3ld", value);
Text(rp, text, 3);
break;
case LEVEL_GADGET:
Move(rp, 238, 98);
sprintf(text, "%3ld", value);
Text(rp, text, 3);
break;
case ALTERNATE_GADGET:
if (value == 0)
{
Move(rp, 238, 108);
sprintf(text, "%.3s", on[value]);
Text(rp, text, 3);
}
else
{
Move(rp, 238, 108);
sprintf(text, "%3ld", value);
Text(rp, text, 3);
}
break;
case PAN_GADGET:
if (value == 0)
{
Move(rp, 238, 118);
sprintf(text, "%.3s", on[2]);
Text(rp, text, 3);
}
else
{
Move(rp, 238, 118);
sprintf(text, "%3ld", value);
Text(rp, text, 3);
}
break;
case REVERB_GADGET:
Move(rp, 238, 128);
sprintf(text, "%3ld", value);
Text(rp, text, 3);
break;
case CHORUS_GADGET:
Move(rp, 238, 138);
sprintf(text, "%3ld", value);
Text(rp, text, 3);
break;
case VARFX_GADGET:
Move(rp, 238, 148);
sprintf(text, "%3ld", value);
Text(rp, text, 3);
break;
case KEYASSIGN_GADGET:
Move(rp, 345, 78);
sprintf(text, "%.6s", keas[value]);
Text(rp, text, 6);
break;
case RCVNOTEOFF_GADGET:
Move(rp, 345, 88);
sprintf(text, "%.3s", on[value]);
Text(rp, text, 3);
break;
case RCVNOTEON_GADGET:
Move(rp, 345, 98);
sprintf(text, "%.3s", on[value]);
Text(rp, text, 3);
break;
case FICUTOFFREQ_GADGET:
Move(rp, 238, 168);
sprintf(text, "%3ld", value);
Text(rp, text, 3);
break;
case FICUTOFFRESON_GADGET:
Move(rp, 238, 178);
sprintf(text, "%3ld", value);
Text(rp, text, 3);
break;
case ATTACK_GADGET:
Move(rp, 238, 188);
sprintf(text, "%3ld", value);
Text(rp, text, 3);
break;
case DECAYA_GADGET:
Move(rp, 238, 198);
sprintf(text, "%3ld", value);
Text(rp, text, 3);
break;
case DECAYB_GADGET:
Move(rp, 238, 208);
sprintf(text, "%3ld", value);
Text(rp, text, 3);
break;
case VXON_GADGET:
Move(rp, 325, 149);
sprintf(text, "%.3s", on[value]);
Text(rp, text, 3);
break;
case DRUMSET_GADGET:
Move(rp, 57, 30);
sprintf(text, "%1ld", value+1);
Text(rp, text, 1);
break;
default:
break;
}
sprintf(tname, "Name:%25.25s", (matrix[kitnr * MAX_INSTRUMENTS+instrm])?
(char *)matrix[kitnr * MAX_INSTRUMENTS+instrm]:(char *)EMPTY);
SetAPen(rp, 4);
SetBPen(rp, 7);
SetDrMd(rp, INVERSVID|JAM2);
Move(rp, 69, 30);
Text(rp, tname, strlen(tname));
return (value);
}
//to hear the changes
static void send_note(struct DRXGTool *tool, const long time, const UBYTE note)
{
struct NoteEvent *on_event = (struct NoteEvent *)(*functions->allocevent)();
if (on_event)
{
struct NoteEvent *off_event = (struct NoteEvent *)(*functions->allocevent)();
if (off_event)
{
on_event->next =
off_event->next = NULL;
on_event->type =
off_event->type = EVENT_VOICE;
on_event->status = MIDI_NOTEON;
off_event->status = MIDI_NOTEOFF;
on_event->value =
off_event->value = note;
on_event->velocity = 80;
on_event->time = time;
off_event->time = time + 96;
on_event->tool =
off_event->tool = tool->tool.next;
(*functions->qevent)(on_event);
(*functions->qevent)(off_event);
}
else
{
(*functions->freeevent)(on_event);
}
}
}
//the center off all
static void __saveds edittoolcode(struct DRXGTool *tool)
{
struct IntuiMessage *message;
struct Window *window;
struct Event *msba_event;
struct Event *msbb_event;
struct Event *pc_event;
LONG class, code, time;
struct Gadget *gadget;
struct NewWindow *newwindow;
int i, b, c, a, revres=0;
char *kittypebt;
UBYTE kittypbyte[11] ={0, 1, 8, 16, 24, 32, 40, 70};
char storage1[32];
char storage2[32];
char storage3[32];
char storage4[32];
char storage5[32];
char storage6[32];
char storage7[32];
char storage8[32];
char storage9[32];
char storage10[32];
char storage11[32];
char storage12[32];
char storage13[32];
char storage14[32];
char storage15[32];
char storage16[32];
char storage17[32];
char storage18[32];
char storage19[32];
char storage20[32];
char storage21[32];
DRXGNewWindowStructure1.Screen = functions->screen;
if (tool->tool.touched & TOUCH_EDIT)
{
DRXGNewWindowStructure1.LeftEdge = tool->tool.left;
DRXGNewWindowStructure1.TopEdge = tool->tool.top;
DRXGNewWindowStructure1.Width = tool->tool.width;
DRXGNewWindowStructure1.Height = tool->tool.height;
}
if (!tool->tool.touched)
{
DRXG_tool_init(tool);
}
newwindow = (struct NewWindow *) (*functions->DupeNewWindow)(&DRXGNewWindowStructure1);
if (!newwindow)
{
return;
}
newwindow->Title = 0;
newwindow->Flags |= BORDERLESS;
newwindow->Flags &= ~0xF;
newwindow->BlockPen = 0;
newwindow->DetailPen = 0;
window = (struct Window *) (*functions->FlashyOpenWindow)(newwindow);
if (!window)
{
return;
}
tool->tool.window = window;
(*functions->EmbossWindowOn)(window, WINDOWCLOSE|WINDOWDEPTH|WINDOWDRAG, DRXG_NAME, (short)-1, (short)-1, 0, 0);
(*functions->EmbossedPropOn)(window, KIT_GADGET, (void *)display_routine, 11, 0);
(*functions->EmbossedPropOn)(window, INSTRUMENT_GADGET, (void *)display_routine, 79, 0);
(*functions->EmbossedPropOn)(window, PITCHCOURSE_GADGET, (void *)display_routine, 128, 0);
for (i = PITCHCOURSE_GADGET; i <= VARFX_GADGET; i++)
{
(*functions->EmbossedPropOn)(window, i, (void *)display_routine, 128, 0);
}
(*functions->EmbossedPropOn)(window, KEYASSIGN_GADGET, (void *)display_routine, 2, 0);
(*functions->EmbossedPropOn)(window, RCVNOTEOFF_GADGET, (void *)display_routine, 2, 0);
(*functions->EmbossedPropOn)(window, RCVNOTEON_GADGET, (void *)display_routine, 2, 0);
for (i = FICUTOFFREQ_GADGET; i <= DECAYB_GADGET; i++)
{
(*functions->EmbossedPropOn)(window, i, (void *)display_routine, 128, 0);
}
(*functions->EmbossedPropOn)(window, VXON_GADGET, (void *)display_routine, 2, 0);
(*functions->EmbossedPropOn)(window, DRUMSET_GADGET, (void *)display_routine, 2, 0);
(*functions->EmbossOn)(window, WRITE_GADGET, 1);
(*functions->EmbossOn)(window, DEFAULT_GADGET, 1);
(*functions->ModifyEmbossedProp)(window, KIT_GADGET, tool->kit, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, INSTRUMENT_GADGET, tool->instrument, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, PITCHCOURSE_GADGET, tool->pitchcourse, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, PITCHFINE_GADGET, tool->pitchfine, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, LEVEL_GADGET, tool->level, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, ALTERNATE_GADGET, tool->alternate, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, PAN_GADGET, tool->pan, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, REVERB_GADGET, tool->reverb, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, CHORUS_GADGET, tool->chorus, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, VARFX_GADGET, tool->varfx, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, KEYASSIGN_GADGET, tool->keyassign, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, RCVNOTEOFF_GADGET, tool->rcvnoteoff, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, RCVNOTEON_GADGET, tool->rcvnoteon, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, FICUTOFFREQ_GADGET, tool->ficutoffreq, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, FICUTOFFRESON_GADGET, tool->ficutoffreson, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, ATTACK_GADGET, tool->attack, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, DECAYA_GADGET, tool->decaya, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, DECAYB_GADGET, tool->decayb, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, VXON_GADGET, tool->vxon, 0, 0, 0, 0, 0);
(*functions->ModifyEmbossedProp)(window, DRUMSET_GADGET, tool->drumset, 0, 0, 0, 0, 0);
for (i= KIT_GADGET; i<=DRUMSET_GADGET ; i++)
{
(*functions->DrawEmbossedProp)(window, i);
}
trans_hx(tool, functions->timenow, "F043104c02015a01f7", 0);
initvx(tool, functions->timenow);
send_note(tool, functions->timenow, 13);
for (;;)
{
message = (struct IntuiMessage *) (*functions->GetIntuiMessage)(window);
class = message->Class;
code = message->Code;
gadget = (struct Gadget *) message->IAddress;
class = (*functions->SystemGadgets)(window, class, gadget, code);
ReplyMsg((struct Message *)message);
if (class == CLOSEWINDOW)
{
break;
}
else if (class == GADGETDOWN)
{
const short id = gadget->GadgetID;
a = ((tool->valstorage[1])-13)*20;
switch (id)
{
case KIT_GADGET:
tool->kit = (UBYTE) (*functions->DragEmbossedProp)(window, KIT_GADGET);
if (tool->kit <= 8)
{
tool->writesw[0] = 1;
tool->msba = 127;
}
if (tool->kit == 9)
{
tool->kit = 0;
tool->msba = 126;
}
if (tool->kit == 10)
{
tool->kit = 1;
tool->msba = 126;
}
msba_event = (struct Event *)(*functions->allocevent)();
if (msba_event)
{
msbb_event = (struct Event *)(*functions->allocevent)();
if (msbb_event)
{
pc_event = (struct Event *)(*functions->allocevent)();
if (pc_event)
{
msba_event->type =
msbb_event->type =
pc_event->type = EVENT_VOICE;
msba_event->status =
msbb_event->status = MIDI_CCHANGE;
msba_event->byte1 = 0x00;
msba_event->byte2 = tool->msba;
msbb_event->byte1 = 0x20;
msbb_event->byte2 = 0x00;
pc_event->status = MIDI_PCHANGE;
pc_event->byte1 = kittypbyte[tool->kit];
time = functions->timenow;
msba_event->time = time;
msbb_event->time = time + 1;
pc_event->time = time + 2;
msba_event->tool =
msbb_event->tool =
pc_event->tool = tool->tool.next;
msba_event->next = msbb_event;
msbb_event->next = pc_event;
pc_event->next = NULL;
(*functions->qevent)(msba_event);
(*functions->qevent)(msbb_event);
(*functions->qevent)(pc_event);
}
else
{
(*functions->freeevent)(msba_event);
(*functions->freeevent)(msbb_event);
}
}
else
{
(*functions->freeevent)(msba_event);
}
}
defaultslider(tool, window);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case INSTRUMENT_GADGET:
tool->instrument = (UBYTE)(*functions->DragEmbossedProp)(window, INSTRUMENT_GADGET);
tool->valstorage[1] = (tool->instrument)+13;
initslider(tool, window);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case PITCHCOURSE_GADGET:
tool->pitchcourse = (UBYTE) (*functions->DragEmbossedProp)(window, PITCHCOURSE_GADGET);
tool->valstorage[2+a] = tool->pitchcourse;
tool->writesw[2+a] = 1;
sprintf(storage2, "F043104C3%1lx%02lx00%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->pitchcourse);
tool->pitchcoursesysex = storage2;
time = functions->timenow;
trans_hx(tool, time, tool->pitchcoursesysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case PITCHFINE_GADGET:
tool->pitchfine = (UBYTE) (*functions->DragEmbossedProp)(window, PITCHFINE_GADGET);
tool->valstorage[3+a] = tool->pitchfine;
tool->writesw[3+a] = 1;
sprintf(storage3, "F043104C3%1lx%02lx01%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->pitchfine);
tool->pitchfinesysex = storage3;
time = functions->timenow;
trans_hx(tool, time, tool->pitchfinesysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case LEVEL_GADGET:
tool->level = (UBYTE) (*functions->DragEmbossedProp)(window, LEVEL_GADGET);
tool->valstorage[4+a] = tool->level;
tool->writesw[4+a] = 1;
sprintf(storage4, "F043104C3%1lx%02lx02%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->level);
tool->levelsysex = storage4;
time = functions->timenow;
trans_hx(tool, time, tool->levelsysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case ALTERNATE_GADGET:
tool->alternate = (UBYTE) (*functions->DragEmbossedProp)(window, ALTERNATE_GADGET);
tool->valstorage[6+a] = tool->alternate;
tool->writesw[5+a] = 1;
sprintf(storage5, "F043104C3%1lx%02lx03%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->alternate);
tool->alternatesysex = storage5;
time = functions->timenow;
trans_hx(tool, time, tool->alternatesysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case PAN_GADGET:
tool->pan = (UBYTE) (*functions->DragEmbossedProp)(window, PAN_GADGET);
tool->valstorage[6+a] = tool->pan;
tool->writesw[6+a] = 1;
sprintf(storage6, "F043104C3%1lx%02lx04%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->pan);
tool->pansysex = storage6;
time = functions->timenow;
trans_hx(tool, time, tool->pansysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case REVERB_GADGET:
tool->reverb = (UBYTE) (*functions->DragEmbossedProp)(window, REVERB_GADGET);
tool->valstorage[7+a] = tool->reverb;
tool->writesw[7+a] = 1;
sprintf(storage7, "F043104C3%1lx%02lx05%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->reverb);
tool->reverbsysex = storage7;
time = functions->timenow;
trans_hx(tool, time, tool->reverbsysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case CHORUS_GADGET:
tool->chorus = (UBYTE) (*functions->DragEmbossedProp)(window, CHORUS_GADGET);
tool->valstorage[8+a] = tool->chorus;
tool->writesw[8+a] = 1;
sprintf(storage8, "F043104C3%1lx%02lx06%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->chorus);
tool->chorussysex = storage8;
time = functions->timenow;
trans_hx(tool, time, tool->chorussysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case VARFX_GADGET:
tool->varfx = (UBYTE) (*functions->DragEmbossedProp)(window, VARFX_GADGET);
tool->valstorage[9+a] = tool->varfx;
tool->writesw[9+a] = 1;
sprintf(storage9, "F043104C3%1lx%02lx07%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->varfx);
tool->varfxsysex = storage9;
time = functions->timenow;
trans_hx(tool, time, tool->varfxsysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case KEYASSIGN_GADGET:
tool->keyassign = (UBYTE) (*functions->DragEmbossedProp)(window, KEYASSIGN_GADGET);
tool->valstorage[10+a] = tool->keyassign;
tool->writesw[10+a] = 1;
sprintf(storage10, "F043104C3%1lx%02lx08%02lxF7",tool->valstorage[19],tool->valstorage[1], tool->keyassign);
tool->keyassignsysex = storage10;
time = functions->timenow;
trans_hx(tool, time, tool->keyassignsysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case RCVNOTEOFF_GADGET:
tool->rcvnoteoff = (UBYTE) (*functions->DragEmbossedProp)(window, RCVNOTEOFF_GADGET);
tool->valstorage[11+a] = tool->rcvnoteoff;
tool->writesw[11+a] = 1;
sprintf(storage11, "F043104C3%1lx%02lx09%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->rcvnoteoff);
tool->rcvnoteoffsysex = storage11;
time = functions->timenow;
trans_hx(tool, time, tool->rcvnoteoffsysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case RCVNOTEON_GADGET:
tool->rcvnoteon = (UBYTE) (*functions->DragEmbossedProp)(window, RCVNOTEON_GADGET);
tool->valstorage[12+a] = tool->rcvnoteon;
tool->writesw[12+a] = 1;
sprintf(storage12, "F043104C3%1lx%02lx0A%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->rcvnoteon);
tool->rcvnoteonsysex = storage12;
time = functions->timenow;
trans_hx(tool, time, tool->rcvnoteonsysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case FICUTOFFREQ_GADGET:
tool->ficutoffreq = (UBYTE) (*functions->DragEmbossedProp)(window, FICUTOFFREQ_GADGET);
tool->valstorage[13+a] = tool->ficutoffreq;
tool->writesw[13+a] = 1;
sprintf(storage13, "F043104C3%1lx%02lx0B%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->ficutoffreq);
tool->ficutoffreqsysex = storage13;
time = functions->timenow;
trans_hx(tool, time, tool->ficutoffreqsysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case FICUTOFFRESON_GADGET:
tool->ficutoffreson = (UBYTE) (*functions->DragEmbossedProp)(window, FICUTOFFRESON_GADGET);
tool->valstorage[14+a] = tool->ficutoffreson;
tool->writesw[14+a] = 1;
sprintf(storage14, "F043104C3%1lx%02lx0C%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->ficutoffreson);
tool->ficutoffresonsysex = storage14;
time = functions->timenow;
trans_hx(tool, time, tool->ficutoffresonsysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case ATTACK_GADGET:
tool->attack = (UBYTE) (*functions->DragEmbossedProp)(window, ATTACK_GADGET);
tool->valstorage[15+a] = tool->attack;
tool->writesw[15+a] = 1;
sprintf(storage15, "F043104C3%1lx%02lx0D%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->attack);
tool->attacksysex = storage15;
time = functions->timenow;
trans_hx(tool, time, tool->attacksysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case DECAYA_GADGET:
tool->decaya = (UBYTE) (*functions->DragEmbossedProp)(window, DECAYA_GADGET);
tool->valstorage[16+a] = tool->decaya;
tool->writesw[16+a] = 1;
sprintf(storage16, "F043104C3%1lx%02lx0E%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->decaya);
tool->decayasysex = storage16;
time = functions->timenow;
trans_hx(tool, time, tool->decayasysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case DECAYB_GADGET:
tool->decayb = (UBYTE) (*functions->DragEmbossedProp)(window, DECAYB_GADGET);
tool->valstorage[17+a] = tool->decayb;
tool->writesw[17+a] = 1;
sprintf(storage17, "F043104C3%1lx%02lx0F%02lxF7",tool->valstorage[19],tool->valstorage[1],tool->decayb);
tool->decaybsysex = storage17;
time = functions->timenow;
trans_hx(tool, time, tool->decaybsysex, 0);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case VXON_GADGET:
tool->vxon = (UBYTE) (*functions->DragEmbossedProp)(window, VXON_GADGET);
tool->valstorage[18] = tool->vxon;
tool->writesw[18] = 1;
sprintf(storage18, "F043104C02015A%02lxF7",tool->vxon);
tool->vxonsysex = storage18;
time = functions->timenow;
trans_hx(tool, time, tool->vxonsysex, 0);
send_note(tool, functions->timenow+30, tool->valstorage[1]);
break;
case DRUMSET_GADGET:
tool->drumset = (UBYTE) (*functions->DragEmbossedProp)(window, DRUMSET_GADGET);
tool->valstorage[19] = tool->drumset;
tool->writesw[19] = 1;
defaultslider(tool, window);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case DEFAULT_GADGET:
defaultslider(tool, window);
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
case WRITE_GADGET:
if ((*functions->areyousure)("write to track ? Play-pointer on right place ?"))
{
if (!functions->running)
{
time = functions->starttime;
if (time == 0) time = 6;
msba_event = (struct Event *)(*functions->allocevent)();
if (msba_event)
{
msbb_event = (struct Event *)(*functions->allocevent)();
if (msbb_event)
{
pc_event = (struct Event *)(*functions->allocevent)();
if (pc_event)
{
msba_event->type =
msbb_event->type =
pc_event->type = EVENT_VOICE;
msba_event->status =
msbb_event->status = MIDI_CCHANGE;
msba_event->byte1 = 0x00;
msba_event->byte2 = tool->msba;
msbb_event->byte1 = 0x20;
msbb_event->byte2 = 0x00;
pc_event->status = MIDI_PCHANGE;
pc_event->byte1 = kittypbyte[tool->kit];
msba_event->time = time;
msbb_event->time = time + 1;
pc_event->time = time + 2;
msba_event->tool =
msbb_event->tool =
pc_event->tool = tool->tool.next;
msba_event->next = msbb_event;
msbb_event->next = pc_event;
pc_event->next = NULL;
if (lock_clip(&(tool->tool.track->clip)))
{
pc_event->next = tool->tool.track->clip.events.first;
tool->tool.track->clip.events.first =
(struct Event *)(*functions->sorteventlist)(msba_event);
unlock_clip(&(tool->tool.track->clip));
}
else
{
(*functions->freelist)(msba_event);
}
}
else
{
(*functions->freeevent)(msba_event);
(*functions->freeevent)(msbb_event);
}
}
else
{
(*functions->freeevent)(msba_event);
}
}
for (b=0; b<=79; b++)
{
if (tool->writesw[2+(b*20)] == 1)
{
sprintf(storage1, "F043104C3%1lx%02lx00%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+2]);
tool->pitchcoursesysex = storage1;
trans_hx(tool, time, tool->pitchcoursesysex, 1);
}
if (tool->writesw[3+(b*20)] == 1)
{
sprintf(storage2, "F043104C3%1lx%02lx01%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+3]);
tool->pitchfinesysex = storage2;
trans_hx(tool, time+1, tool->pitchfinesysex, 1);
}
if (tool->writesw[4+(b*20)] == 1)
{
sprintf(storage3, "F043104C3%1lx%02lx02%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+4]);
tool->levelsysex = storage3;
trans_hx(tool, time+2, tool->levelsysex, 1);
}
if (tool->writesw[5+(b*20)] == 1)
{
sprintf(storage4, "F043104C3%1lx%02lx03%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+5]);
tool->alternatesysex = storage4;
trans_hx(tool, time+3, tool->alternatesysex, 1);
}
if (tool->writesw[6+(b*20)] == 1)
{
sprintf(storage5, "F043104C3%1lx%02lx04%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+6]);
tool->pansysex = storage5;
trans_hx(tool, time+4, tool->pansysex, 1);
}
if (tool->writesw[7+(b*20)] == 1)
{
sprintf(storage6, "F043104C3%1lx%02lx05%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+7]);
tool->reverbsysex = storage6;
trans_hx(tool, time+5, tool->reverbsysex, 1);
}
if (tool->writesw[8+(b*20)] == 1)
{
sprintf(storage7, "F043104C3%1lx%02lx06%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+8]);
tool->chorussysex = storage7;
trans_hx(tool, time+6, tool->chorussysex, 1);
}
if (tool->writesw[9+(b*20)] == 1)
{
sprintf(storage8, "F043104C3%1lx%02lx07%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+9]);
tool->varfxsysex = storage8;
trans_hx(tool, time+7, tool->varfxsysex, 1);
}
if (tool->writesw[10+(b*20)] == 1)
{
sprintf(storage9, "F043104C3%1lx%02lx08%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+10]);
tool->keyassignsysex = storage9;
trans_hx(tool, time+8, tool->keyassignsysex, 1);
}
if (tool->writesw[11+(b*20)] == 1)
{
sprintf(storage10, "F043104C3%1lx%02lx09%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+11]);
tool->rcvnoteoffsysex = storage10;
trans_hx(tool, time+9, tool->rcvnoteoffsysex, 1);
}
if (tool->writesw[12+(b*20)] == 1)
{
sprintf(storage11, "F043104C3%1lx%02lx0A%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+12]);
tool->rcvnoteonsysex = storage11;
trans_hx(tool, time+10, tool->rcvnoteonsysex, 1);
}
if (tool->writesw[13+(b*20)] == 1)
{
sprintf(storage12, "F043104C3%1lx%02lx0D%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+13]);
tool->ficutoffreqsysex = storage12;
trans_hx(tool, time+11, tool->ficutoffreqsysex, 1);
}
if (tool->writesw[14+(b*20)] == 1)
{
sprintf(storage13, "F043104C3%1lx%02lx6E%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+14]);
tool->ficutoffresonsysex = storage13;
trans_hx(tool, time+12, tool->ficutoffresonsysex, 1);
}
if (tool->writesw[15+(b*20)] == 1)
{
sprintf(storage14, "F043104C3%1lx%02lx0E%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+15]);
tool->attacksysex = storage14;
trans_hx(tool, time+13, tool->attacksysex, 1);
}
if (tool->writesw[16+(b*20)] == 1)
{
sprintf(storage15, "F043104C3%1lx%02lx10%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+16]);
tool->decayasysex = storage15;
trans_hx(tool, time+14, tool->decayasysex, 1);
}
if (tool->writesw[17+(b*20)] == 1)
{
sprintf(storage16, "F043104C3%1lx%02lx0F%02lxF7",tool->drumset,b,tool->valstorage[(b*20)+17]);
tool->decaybsysex = storage16;
trans_hx(tool, time+15, tool->decaybsysex, 1);
}
if (tool->writesw[18+(b*20)] == 1)
{
sprintf(storage17, "F043104C3%1lx%02lx11%02lxF7",tool->drumset,b,tool->valstorage[18]);
tool->vxonsysex = storage17;
trans_hx(tool, time+16, tool->vxonsysex, 1);
}
time=time+20;
}
}
}
send_note(tool, functions->timenow, tool->valstorage[1]);
break;
default:
break;
}
}
else if (class == GADGETUP)
{
/* Nothing. */
}
}
tool->tool.window = 0;
tool->tool.left = window->LeftEdge;
tool->tool.top = window->TopEdge;
tool->tool.width = window->Width;
tool->tool.height = window->Height;
tool->tool.touched = TOUCH_INIT | TOUCH_EDIT;
for (i = KIT_GADGET;
i <= DRUMSET_GADGET;
i ++)
{
(*functions->EmbossedPropOff)(window, i);
}
(*functions->EmbossOff)(window, WRITE_GADGET);
(*functions->EmbossOff)(window, DEFAULT_GADGET);
(*functions->EmbossWindowOff)(window);
(*functions->FlashyCloseWindow)(window);
(*functions->DeleteNewWindow)(newwindow);
}
//to leave the tool correct
void __saveds removetool()
{
FreeVec(matrix);
FreeVec(DRXG);
}
//start of the tool
struct ToolMaster * inittoolmaster()
{
int i = 0, pkit = 0;
if (!(DRXG=(UWORD *)AllocVec(sizeof (DRXGdata), MEMF_CHIP|MEMF_CLEAR))) return(NULL);
CopyMem(&DRXGdata, DRXG, sizeof (DRXGdata));
if(!(matrix = (STRPTR *)AllocVec(MAX_KITS*MAX_INSTRUMENTS*sizeof(STRPTR), MEMF_ANY|MEMF_CLEAR)))
return(NULL);
while (dr[i].kit != BE)
{
pkit = dr[i].kit;
matrix[pkit * MAX_INSTRUMENTS + dr[i].instrument] = (STRPTR)dr[i].name;
i++;
}
DRXG_image.ImageData = DRXG;
memset((char *)&master, 0, sizeof(struct ToolMaster));
master.toolid = DRXG_ID;
master.image = &DRXG_image;
strcpy(master.name, DRXG_NAME);
master.edittool = edittoolcode;
master.processevent = processeventcode;
master.tooltype = DRXG_TYPE;
master.toolsize = sizeof(struct DRXGTool);
master.removetool = removetool;
return(&master);
}